﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace CoPro.Configuration
{
    /// <summary>
    /// This is the root CoPro configuration element in the web.config. 
    /// </summary>
    public class CoProConfig : ConfigurationSection
    {
        [ConfigurationProperty("defaultProvider", IsRequired = false)]
        public String DefaultProvider
        {
            get
            {
                return this["defaultProvider"] as String;
            }
        }

        [ConfigurationProperty("providers")]
        public ContentProviderConfigurationCollection Providers
        {
            get
            {
                return this["providers"] as ContentProviderConfigurationCollection;
            }
        }

        /// <summary>
        /// This method returns the CoPro configuration. It assumes that the configuration section is named "coPro". 
        /// </summary>
        /// <returns>CoPro configuration</returns>
        public static CoProConfig GetConfig()
        {
            CoProConfig config = (CoProConfig)ConfigurationManager.GetSection("coPro");

            return config;
        }
    }
}
